package com.pratices.mvc.service;

import com.pratices.mvc.bean.MarketRegion;
import com.pratices.mvc.data.PageInfo;
import com.pratices.mvc.mapper.MarketRegionMapper;
import com.pratices.requestAndResponse.utils.MybatisUtils;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

public class AdminRegionService {
    public PageInfo list(HttpServletRequest req, HttpServletResponse resp) {
        System.out.println("进入到了list内");
        MarketRegionMapper marketRegionMapper = MybatisUtils.getSqlConnection().getMapper(MarketRegionMapper.class);
        List<MarketRegion> marketRegions = marketRegionMapper.selectByPid(0);
        PageInfo pageInfo = new PageInfo();
        pageInfo.setList(marketRegions);
        pageInfo.setTotal(marketRegions.size());
        pageInfo.setPages(1);
        pageInfo.setLimit(marketRegions.size());
        pageInfo.setPage(1);
        return pageInfo;
    }
}
